Release 10.1A: OpenEdge Development:
Progress Dynamics Basic Development


Defining items

An Item can be a menu item in a menu, or a tool in a toolbar, or it can be both. It is a visual representation used to perform an action within the application. The item can publish an event, run a procedure, or launch another application window. When in a toolbar, the item can be visualized as a button, label, or separator. Items can be reused in multiple bands.

To create a new item, do one of the following:

The Item Type can be one of the following:

Rules

Rules are used to enable/disable items, hide/view items, or swap images in toolbar buttons. A rule contains a delimited list of either function references or properties that specify a logical result (either Yes or No), as shown:

  Syntax: [ property | function ] = list [ AND | OR ] ... 

property

The name of a property whose value is retrieved across the specified Item link. This can be any SmartObject property defined in the object across the Item link.

function

A function that is executed across the specified Item link.

list

A comma-delimited list of values that is compared to the property or function result. An OR comparison is performed.

You can define rules to change the state of items in the following ways:

Here is an example from the Enable Rule for the First navigation button:

QueryPosition=LastRecord,NotFirstOrlast and canNavigate() 

QueryPosition is an SDO property that keeps track of whether the SDO’s query is positioned at the beginning, the end, or somewhere else in the data set. The expression “QueryPosition=LastRecord,NotFirstOrlast” means “IF QueryPosition = LastRecord or QueryPosition = NotFirstOrLast”. In other words, if the SDO query is positioned on the LastRecord or positioned somewhere in the middle, then it is appropriate to enable the First button to allow the query to be repositioned to the beginning.

The canNavigate function is defined for SDOs also (in the super procedure data.p, among other places). It returns true if there are no dependent uncommitted updates pending that need to be committed before the query can be repositioned. If both the QueryPosition and canNavigate conditions are met, then the First item (menu item or toolbar button) is enabled. Similar rules are defined for the other navigation items (Next, Prev, and Last).

Here is another example for the Save item in the TableIO Category, which groups buttons and menu items used in the update bands of toolbars:

NewRecord=add,copy or DataModified 

The NewRecord SDO property is set to Add if a new record is being added. It is set to Copy if a new record is being created based on an existing record. Otherwise it is blank. The DataModified SDO property is TRUE if an existing record has been modified on the screen but not yet saved. If either of these conditions is met, then the Save item is enabled.

For more information on SmartObject properties and functions you can use to form rules for changing the state of your items, see OpenEdge Development: ADM Reference .

Note: If you create a rule using custom properties, remember to define the properties in the class. The class must also contain a get function to retrieve each new property.


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095